﻿@model RBS.Core.Model.Sys_Adv
@{
    ViewBag.Title = "内容页";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script src="~/scripts/ajaxfileupload.js"></script>
<link href="~/Scripts/imgshow/thickbox.css" rel="stylesheet" />
<script src="~/Scripts/imgshow/thickbox.js"></script>
<script>
    $(function () {
        //加载城市列表 
        $("#submitImg").click(function () {
            if ($("#boy").val().length > 0) {
                ajaxFileUpload();
            }
            else {
                alert("请选择图片");
            }
        });
        $("#img1").hide();
     /*   $("#addbook").click(function () {
            newbooks = dialog("newbooks", "广告图书", "../BookMgr/BookIndex/AdvBook");
        });*/
    });
    function dialog(id, title, url) {
        abc = $.dialog({
            id: id, lock: true, title: title, zIndex: 9999, width: '710px', height: '520px', content: "url:" + url
        });
        return abc;
    }
    function ajaxFileUpload() {
        $.ajaxFileUpload(
            {
                url: '@Url.Action("UploadAdvImg")', //用于文件上传的服务器端请求地址
                secureuri: false, //一般设置为false
                fileElementId: 'boy', //文件上传空间的id属性  <input type="file" id="file" name="file" />
                dataType: 'HTML', //返回值类型 一般设置为json
                success: function (data, status)  //服务器成功响应处理函数
                {
                    //alert(data);
                    $("#img1").show();
                    $("#img1").attr("src", data);
                    $("#showimg").attr("href", data);
                    $("#AdvImg").val(data);
                    if (typeof (data.error) != 'undefined') {
                        if (data.error != '') {
                            alert(data.error);
                        } else {
                            alert(data.msg);
                        }
                    }
                },
                error: function (data, status, e)//服务器响应失败处理函数
                {
                    alert(e);
                }
            }
        );
    }

</script>
<!--导航栏-->
<div class="location">
    <a href="javascript:history.back(-1);" class="back"><i></i><span>返回列表页</span></a>
    <a href="@Url.Action("Main", "Home")" class="home"><i></i><span>首页</span></a>
    <i class="arrow"></i>
    <span>广告维护</span>
</div>
<!--/导航栏-->
<!--内容-->
<div class="content-tab-wrap">
    <div id="floatHead" class="content-tab">
        <div class="content-tab-ul-wrap">
            <ul>
                <li><a href="javascript:;" onclick="tabs(this);" class="selected">广告维护</a></li>
            </ul>
        </div>
    </div>
</div>
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true) 
    @Html.HiddenFor(model => model.CreateTime);
    @Html.HiddenFor(model => model.Id);
    <div class="tab-content">
        <dl>
            <dt>广告名称</dt>
            <dd>
                @Html.TextBoxFor(model => model.AdvName, null, new { @class = "input normal" })
                <span class="Validform_checktip">*广告名称</span>
            </dd>
        </dl>

        <dl>
            <dt>广告链接</dt>
            <dd> 
                @Html.TextBoxFor(model => model.AdvLink, null, new { @class = "input normal" }) 
                <span class="Validform_checktip">*广告链接</span> 
            </dd>
        </dl>
         <dl>
            <dt>广告类型
            </dt>
            <dd>
                <div class="rule-multi-radio">
                     <label for="AdvPosition">Web首页</label>
                    @Html.RadioButtonFor(model => model.AdvPosition, 0, new { @id = "AdvPosition0", @name = "AdvPosition" })
                    <label for="AdvPosition">Apk首页</label>
                    @Html.RadioButtonFor(model => model.AdvPosition, 1, new { @id = "AdvPosition1", @name = "AdvPosition" }) 
                   
                    <span class="Validform_checktip"></span>
                </div>
            </dd>
        </dl>
        <dl>
            <dt>广告图片</dt>
            <dd> 
                @Html.HiddenFor(model => model.AdvImg)
                <input type="file" id="boy" name="boy" class="input normal upload-path" />
                <input type="button" value="上传" id="submitImg" class="btn btn-default" />
                <br />
                <a id="showimg" title="点击图片查看大图" class="thickbox">
                    <img id="img1" alt="广告大图" width="300" />
                </a> 
            </dd>
        </dl>
        <dl>
            <dt>是否前台显示 
            </dt>
            <dd>
                <div class="rule-multi-radio">
                    <label for="AdvStatus">不显示</label>
                    @Html.RadioButtonFor(model => model.AdvStatus, 0, new { @id = "AdvStatus1", @name = "AdvStatus" })
                    <label for="AdvStatus">显示</label>
                    @Html.RadioButtonFor(model => model.AdvStatus, 1, new { @id = "AdvStatus2", @name = "AdvStatus" })

                    <span class="Validform_checktip">*广告状态</span>
                </div>
            </dd>
        </dl>
        <dl>
            <dt>广告描述</dt>
            <dd>
                @Html.TextBoxFor(model => model.AdvDesc, null, new { @class = "input normal" })
                <span class="Validform_checktip">*广告描述</span>
            </dd>

        </dl>
    </div>
    <!--/内容-->

    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-list">
            <input type="submit" value="提交保存" class="btn" />
            <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />

        </div>
        <div class="clear"></div>
    </div>
    <!--/工具栏-->
        
}










